import java.util.Scanner;

/**
 * @author gao
 * @date 2025/8/13 9:56
 */

public class Solution {
    int path;
    int sum;

    public int subsetXORSum(int[] nums) {
        dfs(nums, 0);
        return sum;
    }

    /**
     * 深度优先搜索，用于计算所有可能的异或路径和
     * @param nums 输入的整数数组
     * @param pos 当前处理位置索引
     */
    private void dfs(int[] nums, int pos) {
        sum += path;
        for (int i = pos; i < nums.length; i++) {
            path ^= nums[i];
            dfs(nums, i + 1);
            // 回溯，恢复路径值到之前的状态
            path ^= nums[i];
        }
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int n = in.nextInt();
            int[] nums = new int[n];
            for (int i = 0; i < nums.length; i++) {
                nums[i] = in.nextInt();
            }
            Solution solution = new Solution();
            System.out.println(solution.subsetXORSum(nums));
        }
    }
}